<!doctype html>
<html lang="zh-CN">
<head>
	<meta charset="UTF-8">
	<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
	<title>钢链网-资源单管理</title>
	<link rel="stylesheet" href="/resource/css/gl_index.css">
	<link rel="stylesheet" href="/resource/css/gl_user.css">

	<script src="/resource/js/jquery-1.11.3.min.js"></script>
	<script src="/resource/js/gl_index.js"></script>
	<script>
		$(function(){
			var popup_del = '<div class=\"popup\"></div><div class=\"popup-show popup-del\">';
		        popup_del += '<div class=\"popup-p\">';
		        popup_del +='<i><img src=\"/resource/img/gl_show_err.png\" alt=""></i>';
		        popup_del +='<div class=\"left\">';           
		        popup_del +='<span style="font-size:18px;color:#211815;">确定要删除此资源单？</span><div style="color:#656464;line-height:20px;margin-bottom:25px;">删除后无法复原</div>';
		        popup_del +='<div class="btn"><a href="javascript:;" class="deter">确定</a>';
		        popup_del +='<a href="javascript:;" class="close">取消</a></div>';
		        popup_del +='</div><div class=\"popup-close\"></div></div></div>'; 
		    $('body').append(popup_del); 
		    $('.popup-show').css('margin-left',-$('.popup-show').width()/2);
		    //删除订单
		    $(document).delegate('.del','click',function(){
		    	var res_id = $(this).attr('res_id');
		    	$('.popup-del .deter').attr('res_id',res_id);
		    	$('.popup-del').show();
		    	$('.popup').show();
		    });
		    $(document).delegate('.popup-del .deter','click',function(){
		    	var res_id = $(this).attr('res_id');
                var page = $('ul.pagination li.active a').html();
                $.ajax({
                    url: "/new_resource_delete",
                    type: "get",
                    data: 'product_id='+res_id,
                    async:false,
                    success: function (msg) {
                        if(msg){
                            $.ajax({
                                url: "/new_resource_ajax",
                                type: "get",
                                async:false,
                                success: function (msg) {
                                    $('#list').html(msg);
                                    window.location.href="http://www.ganglian.com/user_now_resource_admin?page="+page;
                                    if($('.resource tbody tr').length == 1){
                                        window.location.href="http://www.ganglian.com/user_now_resource_admin?page="+(page-1);
                                    }
                                    $('#follow_list').html(msg);
                                }
                            });
                        }
                    }
                });
            });
		});
	</script>
</head>
<body>
<div class="head">
    @include('common.user_head')
</div>
<div class="user-head">
	<div class="main">
		<div class="logo">
			<a href="/"><img src="/resource/img/logo.png" alt=""></a>
			<div>我的钢链网
				<a href="/">返回首页</a>
			</div>
		</div>
	</div>
</div>	
<div class="user main">
    @include('common.user_menu')
	<div class="user-cont">
		<div class="resource">
			<div class="title">资源单管理</div>
			<div class="table" id="list">
				<table>
					<thead>
						<tr>
							<th width="240px">公司抬头</th>
							<th width="245px">上传时间</th>
							<th width="140px">下载次数</th>
							<th width="170px">操作</th>
							<th width="">状态</th>
						</tr>
					</thead>
					<tbody>
                    @if(empty($list))
						<!-- 空的时候 -->
						<tr class="tr-no">
							<td colspan="5">暂无资源单，您可以<a href="javascript:;">去上传资源单</a></td>
						</tr>
                        @else
                                <!-- 有资源单 -->
                        @foreach($list as $v)
						<tr>
							<td><div>{{$v->company}}</div></td>
							<td><div>{{date('Y-m-d H:i:s',$v->created)}}</div></td>
							<td><div>{{$v->down_num}}</div></td>
							<td><div>
								<a href="/look_excel?filename={{str_replace('\\','/',$v->down_address);}}">预览</a>
								<a href="javascript:;" class="del" res_id="{{ $v->product_id }}">删除</a>
							</div></td>
                            <td >@if($v->status == 1)<div class="examine-yes">已通过</div>  @elseif($v->status == 2)<div class="examine-in">审核中</div> @else <div class="examine-no">未通过</div> @endif</td>
							</td>
						</tr>
                        @endforeach
                        @endif
					</tbody>
				</table>
                {{$list->links()}}
			</div>

		</div>
	</div>
</div>
@include('common.shop_foot')
</body>
</html>